// Point.h

// Bod v ortogonalnom suradnicovom systeme 

#ifndef POINT_H
#define POINT_H

// Deklaracia vektora
class Vector;

// Trieda bod v ortog. suradnicovom systeme
class Point
{
	float xPos;	// X-ova suradnica
	float yPos;	// Y-ova suradnica

public:
	// Konstruktor bez parametrov
	Point() : xPos(0), yPos(0)
	{
	
	}
	// Konstruktor s parametrami
	Point(float x, float y) : xPos(x), yPos(y)
	{
	
	}
	// Kopirovaci konstruktor
	Point(const Point& p) : xPos(p.xPos), yPos(p.yPos)
	{
	
	}

	// Pristupove metody
	float GetX() const
	{ 
		return xPos;
	}
	float GetY() const
	{ 
		return yPos;
	}
	void SetX(float x)
	{ 
		xPos = x;
	}
	void SetY(float y)
	{ 
		yPos = y;
	}

	// Operatory 
	inline Point operator +(const Vector& vector) const;
	inline Point operator -(const Vector& vector) const;
	inline Vector operator -(const Point& point) const;

	inline const Point& operator =(const Point& point);
	inline const Point& operator +=(const Vector& vect);
	inline const Point& operator -=(const Vector& vect);
};

// Tento "include" musi byt presne tu, inak sa to nepaci suboru "vector.h"
#include "Common/World/Vector.h"

Point Point::operator +(const Vector& vect) const
{
	return Point(xPos + vect.GetX(), yPos + vect.GetY());
}

Point Point::operator -(const Vector& vect) const
{
	return Point(xPos - vect.GetX(), yPos - vect.GetY());
}

Vector Point::operator -(const Point& point) const
{
	return RectVector(xPos - point.xPos, yPos - point.yPos);
}


const Point& Point::operator =(const Point& point)
{
	xPos = point.xPos; yPos = point.yPos;
	return *this;
}

const Point& Point::operator +=(const Vector& vect)
{
	xPos += vect.GetX(); yPos += vect.GetY();
	return *this;
}

const Point& Point::operator -=(const Vector& vect)
{
	xPos -= vect.GetX(); yPos -= vect.GetY();
	return *this;
}

#endif // POINT_H
